<?php
//定义框架入口
header('content-Type:text/html;charset=utf-8;');
define('APP_PATH', substr(realpath(dirname(__FILE__)), 0, -5)); 

//ini_set("display_errors","On");
//error_reporting(E_ALL);

require_once APP_PATH.'dz_framework/init.php';
//DEBUG 接收对象 动作
$param_arr = getopt('m:a:d:');

$mod = isset($param_arr['m']) ? $param_arr['m']:'user';
$action = isset($param_arr['a']) ? $param_arr['a']:'index';
$do = isset($param_arr['d']) ? $param_arr['d']:'login';
//调试记录 开始
if($_G['config']['debug_log']){
    debug_log();
}
//调试记录 结束

//DEBUG 加载数据处理驱动
$action_class_path = libfile($mod.'/'.$action, 'class','..','/admin');
if(file_exists($action_class_path)){
    require_once $action_class_path;
}
else{
    //TODO 抛出异常
}
//DEBUG 加载业务逻辑驱动 并 处理请求
require_once libfile($mod.'/'.$action, 'module','..','/admin');
if($mod && $action){
    $mod_action_class = 'ctrl_'.$mod.'_'.$action;
    if(class_exists($mod_action_class)){
        $mod_action = new $mod_action_class();
        $ctrl_name = 'do_'.$do;
        $mod_action->$ctrl_name();
    }
}
?>